﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="navigationPane" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="accountPane" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="leftPane" runat="Server">
    <p class="title">Statistics</p>
    <p class="link"><a href="Default.aspx">Overview</a></p>
    <p class="link"><a href="Default.aspx">Edit Page</a></p>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="bodyPane" runat="Server">
    <h1>Available Sites</h1>
    <asp:Repeater ID="Repeater1" DataSourceID="SqlDataSource1" runat="server">
        <HeaderTemplate>
            <table class="tableLayout1" cellpadding="0px" cellspacing="0px">
                <tr>
                    <th>Site</th>
                    <th>Identifier</th>
                    <th>Current month</th>
                </tr>
        </HeaderTemplate>
        <ItemTemplate>
                <tr>
                    <td><asp:HyperLink ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' NavigateUrl='<%# "Site.aspx?site=" + Eval("SiteId") %>' /></td>
                    <td><asp:Label ID="SiteNameLabel" runat="server" Text='<%# Eval("SiteName") %>' /></td>
                    <td>
                        Outgoing: <strong><%# Statistics.FileSizeFormat.ToByteString(long.Parse(Eval("httpSent").ToString())) %></strong>
                        <div class="smallDiagram">
                            <div class="red" style="width:<%# (int)((double)200 / (double.Parse(Eval("httpSent").ToString()) + double.Parse(Eval("httpGet").ToString())) * int.Parse(Eval("httpSent").ToString())) %>px">&nbsp;</div>
                        </div>
                        Incoming: <strong><%# Statistics.FileSizeFormat.ToByteString(long.Parse(Eval("httpGet").ToString()))%></strong>
                        <div class="smallDiagram">
                            <div class="green" style="width:<%# (int)((double)200 / (double.Parse(Eval("httpSent").ToString()) + double.Parse(Eval("httpGet").ToString())) * int.Parse(Eval("httpGet").ToString())) %>px">&nbsp;</div>
                        </div>
                    </td>
                </tr>
        </ItemTemplate>
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:statisticsConnectionString %>" 
        SelectCommand="SELECT SiteId, Name, SiteName, LogPath, (SELECT SUM(Traffic.TrafficHTTPSent) AS httpSent FROM Sites INNER JOIN Traffic ON Sites.SiteId = Traffic.SiteId WHERE (DATEPART(MONTH, Traffic.Date) = DATEPART(MONTH, GETDATE()))) AS httpSent, (SELECT SUM(Traffic_1.TrafficHTTPGet) AS httpGet FROM Sites AS Sites_2 INNER JOIN Traffic AS Traffic_1 ON Sites_2.SiteId = Traffic_1.SiteId WHERE (DATEPART(MONTH, Traffic_1.Date) = DATEPART(MONTH, GETDATE()))) AS httpGet FROM Sites AS Sites_1">
    </asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content6" runat="server" ContentPlaceHolderID="toolbar">
    <div class="breadcrumb">
        <div class="icon"><img src="" alt="" /></div>
        <div class="text">
            <div class="title">Overview</div>
            <div class="subtitle">
                Welcome to the web statistics service from Alexosoft. Here you can see all 
                available sites
            </div>
        </div>
    </div>
</asp:Content>
